//
//  HZJListTableViewCell.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/4/5.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "HZJListTableViewCell.h"

@interface HZJListTableViewCell ()


@property (nonatomic, strong) UILabel *nameLable;

@property (nonatomic, strong) UILabel *heartNum;

@end

@implementation HZJListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.numLable = [[UILabel alloc] initWithFrame:CGRectZero];
//        _numLable.backgroundColor = [UIColor redColor];
        _numLable.textColor = [UIColor colorWithRed:190 / 255.0 green:190 / 255.0 blue:190 / 255.0 alpha:1];
        [self.contentView addSubview:_numLable];
        
        self.titleLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_titleLable];
        
        self.nameLable = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_nameLable];
        
        self.heart = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_heart];
        
        self.heartNum = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:_heartNum];
        
    }
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    self.numLable.frame = CGRectMake(12, self.bounds.size.height / 2 - 10, 20, 20);
    [_numLable sizeToFit];
    self.titleLable.frame = CGRectMake(45, 10, self.bounds.size.width - self.bounds.size.height, 20);
    self.nameLable.frame = CGRectMake(_titleLable.frame.origin.x, 35, 15, 16);
    [_nameLable sizeToFit];
    _nameLable.font = [UIFont systemFontOfSize:14];
    
    self.heart.frame = CGRectMake(_nameLable.frame.origin.x + _nameLable.bounds.size.width, 36, 15, 15);
    _heart.image = [UIImage imageNamed:@"Jxin"];
    
    self.heartNum.frame = CGRectMake(_heart.frame.origin.x + 18, 35, 15, 16);
    [_heartNum sizeToFit];
    _heartNum.font = [UIFont systemFontOfSize:14];
    
}

- (void)setSongModel:(HZ_play_hs_Model *)songModel {
    _songModel = songModel;
    _titleLable.text = songModel.name;
    _nameLable.text = songModel.singerName;
    _heartNum.text = [NSString stringWithFormat:@"%ld", songModel.favorites];
    
}

- (void)setSongDetailModel:(HZJSongDetailModel *)songDetailModel {
    
    _songDetailModel = songDetailModel;
    _titleLable.text = songDetailModel.name;
    _nameLable.text = songDetailModel.singerName;
    _heartNum.text = [NSString stringWithFormat:@"%@", songDetailModel.favorites];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
